package cn.liziy;

import cn.liziy.controller.UserController;
import cn.liziy.dao.impl.UserDaoImpl;
import cn.liziy.entity.User;
import cn.liziy.service.impl.UserServiceImpl;
import liziy.spring.context.annotation.AnnotationConfigApplicationContext;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("cn.liziy");
        Object dao = context.getBean("dao");
        System.out.println(dao);
        System.out.println("=========");
        UserServiceImpl userServiceImpl = (UserServiceImpl) context.getBean("userServiceImpl");
        System.out.println(userServiceImpl);
        System.out.println("=========");
        UserController userController = (UserController) context.getBean("userController");
        User user = userController.getUser(1);
        System.out.println(user);
        // System.out.println(context.getBean("userServiceImpl"));
        //判断某个注解上是否存储某个注解
//        Class<UserDaoImpl> userDaoClass = UserDaoImpl.class;
//        Repository annotation = userDaoClass.getAnnotation(Repository.class);
//        Class<? extends Annotation> aClass = annotation.annotationType();
//        Component annotation1 = aClass.getAnnotation(Component.class);
//        System.out.println(annotation1);

    }
}
